package com.ran.mvpdemo.model;

import android.util.Log;

import com.ran.mvpdemo.presenter.MainPresenter;


/**
 * Created by Bruce on 2017/5/17.
 */

public class MainModel {
    private static final String TAG=MainModel.class.getSimpleName();
    MainPresenter mainPresenter;
    Model model;

    public MainModel(MainPresenter mainPresenter) {
        this.mainPresenter = mainPresenter;
    }
    //从服务器中获取数据
    public void getData(){
        Log.d(TAG,"getData()");
        //这个方法主要是获取数据如果成功则调用MainPresenter的loadDataSuccess 方法
        //如果失败就调用MainPresenter的loadFail()方法
        model=new Model();
        model.setName("这是Model层处理的数据，传回到UI层显示。");
        mainPresenter.loadDataSuccess(model);
    }
}
